import pymongo

ip ='118.24.27.37'
port = 27017

client = pymongo.MongoClient("mongodb://118.24.27.37:27017/")
db = client['python']
my_C = db['stu']
# 查询
# result1 = my_C.find_one()
# result2 = my_C.find()
# for i in result2:
#     print(i)
# 添加
# my_C.insert_many([
#     {"stu_name":'haha',"age":19,"no":201246}
# ])
# 删除
# my_C.delete_one({'name': 'longtao2'})

# 修改
# my_C.update_one({'stu_name':'haha'},{'$set':{'name':'longtao'}})
result2 = my_C.find()
for i in result2:
    print(i)
